#!/usr/bin/env bash
echo "加载了公共方法"
mkdir -p /data/afupanel
cd /data/afupanel

# 蓝色打印
function BlueEcho() {
    echo -e "\033[34m${1}\033[0m"
}

# 红色打印
function RedEcho() {
    echo -e "\033[31m${1}\033[0m"
}

# 黄色打印
function YellowEcho() {
    echo -e "\033[33m${1}\033[0m"
}

# 绿色打印
function GreenEcho() {
    echo -e "\033[32m${1}\033[0m"
}
# 颜色查看地址：https://www.cnblogs.com/zhangrui153169/p/11507935.html

# 检查内存容量是否符合要求
function CheckMem() {
    minMen=$1
    free -m
}

# 关闭Selinux
function DisableSelinux() {
    if [ -s /etc/selinux/config ]; then
        sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
    fi
}

# 产生随机密码，bash的return 仅支持数值，因此使用echo
function RandomPwd() {
    pwdLength=$1
    if [ "$pwdLength" == "" ]; then
        pwdLength=15
    fi
    echo $(tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' </dev/urandom | head -c ${pwdLength})
}

MakeInstall()
{
    make -j `grep 'processor' /proc/cpuinfo | wc -l`
    if [ $? -ne 0 ]; then
        make
    fi
    make install
}












